namespace FIREFLYX {
    window.onload = () => {
        let className = "CamViewModel";
        let needVConsole = false;
        //url 参数
        if (window && window.location) {
            //test url "127.0.0.1?example=CamViewModel&vconsole=1"  //查看CamViewModel样例 ，打开vconsole
            const urlPar = new URL(window.location.href).searchParams;
            className = urlPar.get("example") || className;                                 //样例选择
            needVConsole = Boolean(urlPar.get("vconsole")) || needVConsole;                 //虚拟控制台
        }

        //虚拟控制台
        if (needVConsole) {
            (window as any).eruda.init(); //html 调试  虚拟控制台
        }

        //选择样例
        let canvasElement = document.getElementById("webglCanvas") as HTMLCanvasElement;
        if ((FIREFLYX as any)[className] == null) {
            let info = `not find example of ${className}. `;
            console.error(info);
            alert(info);
            return;
        }

        //实例创建
        console.log(`onload start! example : ${className}`);
        let obj = new (FIREFLYX as any)[className]() as IExample;
        obj.Init(canvasElement);
    };
}